import { createSlice } from "@reduxjs/toolkit";
const counterSlice = createSlice({
  name: 'counter',
  initialState: {
    value: 100,
  },
  reducers: {
    increment(state) {
      state.value++
    },
    decrement(state) {
      state.value--
    }
  }
})

export const { increment, decrement } = counterSlice.actions // 单独抛出action，
export default counterSlice.reducer // 抛出reducer，供状态机初始化使用